package com.zy.chat.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zy.chat.entity.Comments;
import com.zy.chat.mapper.CommentMapper;
import com.zy.chat.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * @author zy
 * @date 2023/5/17 17:15
 */

@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comments> implements CommentService {
    @Autowired
    private  CommentMapper commentMapper;
    @Override
    public int insert(Comments comments) {
        Timestamp currentTime = new Timestamp(System.currentTimeMillis());  // 获取当前时间戳
        comments.setCreateTime(currentTime);
        comments.setUpdateTime(currentTime);
        commentMapper.insert(comments);
        return 1;
    }
}
